% test @RELATION dataset_time_4 @ATTRIBUTE Id STRING @ATTRIBUTE Title STRING @ATTRIBUTE Body STRING @ATTRIBUTE Tags STRING @ATTRIBUTE CreationDate STRING @ATTRIBUTE Y STRING @DATA 34552656,'Java: Repeat Task Every Random Seconds','
I\'m already familiar with repeating tasks every n seconds by using Java.util.Timer and Java.util.TimerTask. But lets say I want to print \"Hello World\" to the console every random seconds from 1-5. Unfortunately I\'m in a bit of a rush and don\'t have any code to show so far. Any help would be apriciated.
\n',I\'d like to understand why Java 8 Optionals were designed to be immutable. Is it just for thread-safety?
\n',I am attempting to overlay a title over an image - with the image darkened with a lower opacity. However, the opacity effect is changing the overlaying text as well - making it dim. Any fix to this? Here is what is looks like:
\n\n\n\nAnd here is my code for the custom component (article preview - which the above image is a row of article preview components):
\n\n//component for article preview touchable image\n/* will require the following\n- rss feed and api\n- user\'s keyword interests from parse In home.js\n- parse db needs to be augmented to include what they heart\n- parse db needs to be augmented to include what they press on (like google news)\n*/\nvar React = require(\'react-native\');\nvar {\n View, \n StyleSheet, \n Text, \n Image, \n TouchableHighlight, \n} = React;\n\n//dimensions\nvar Dimensions = require(\'Dimensions\');\nvar window = Dimensions.get(\'window\');\nvar ImageButton = require(\'../../common/imageButton\');\nvar KeywordBox = require(\'../../authentication/onboarding/keyword-box\');\n\n//additional libraries\n\nmodule.exports = React.createClass({\n //onPress function that triggers when button pressed\n //this.props.text is property that can be dynamically filled within button \n /* following props:\n - source={this.props.source}\n - onPress={this.props.onPress}\n - {this.props.text}\n - {this.props.heartText}\n - key={this.props.key} \n - text={this.props.category} \n - this.props.selected\n */\n render: function() {\n return (\n <TouchableHighlight \n underlayColor={\'transparent\'}\n onPress={this.props.onPress} >\n <Image \n source={this.props.source} \n style={[styles.articlePreview, this.border(\'red\')]}>\n <View style={[styles.container, this.border(\'organge\')]}>\n <View style={[styles.header, this.border(\'blue\')]}>\n <Text style={[styles.previewText]}>{this.props.text}</Text>\n </View>\n <View style={[styles.footer, this.border(\'white\')]}>\n <View style={[styles.heartRow, this.border(\'black\')]}>\n <ImageButton\n style={[styles.heartBtn, , this.border(\'red\')]}\n resizeMode={\'contain\'}\n onPress={this.onHeartPress}\n source={require(\'../../img/heart_btn.png\')} />\n <Text style={[styles.heartText]}>{this.props.heartText + \' favorites\'}</Text>\n </View>\n <KeywordBox \n style={[styles.category, this.border(\'blue\')]}\n key={this.props.key} \n text={this.props.category} \n onPress={this.props.categoryPress}\n selected={this.props.selected} />\n </View>\n </View>\n </Image>\n </TouchableHighlight>\n );\n }, \n onHeartPress: function() {\n //will move this function to a general module\n }, \n border: function(color) {\n return {\n //borderColor: color, \n //borderWidth: 4,\n } \n },\n});\n\nvar styles = StyleSheet.create({\n heartText: {\n color: \'white\', \n fontSize: 12, \n fontWeight: \'bold\',\n alignSelf: \'center\', \n marginLeft: 5, \n fontFamily: \'SFCompactText-Medium\'\n }, \n heartRow: {\n flexDirection: \'row\', \n justifyContent: \'space-around\', \n alignSelf: \'center\', \n justifyContent: \'center\', \n }, \n heartBtn: {\n height: (92/97)*(window.width/13), \n width: window.width/13, \n alignSelf:\'center\', \n }, \n category: {\n fontFamily: \'Bebas Neue\', \n fontSize: 10,\n fontWeight: \'bold\'\n }, \n header: {\n flex: 3, \n alignItems: \'center\', \n justifyContent: \'space-around\', \n marginTop: window.height/30,\n }, \n footer: {\n flex: 1, \n flexDirection: \'row\', \n justifyContent: \'space-between\', \n alignItems: \'center\', \n margin: window.height/50,\n }, \n container: {\n flex: 1, \n backgroundColor: \'black\', \n opacity: 0.6, \n }, \n articlePreview: {\n flex: 1, \n height: window.height/3.2, \n width: window.width, \n flexDirection: \'column\'\n }, \n previewText: {\n fontFamily: \'Bebas Neue\', \n fontSize: 23,\n color: \'white\', \n alignSelf: \'center\', \n textAlign: \'center\', \n margin: 5, \n position: \'absolute\',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n }, \n\n});\n
\n',The question is very simple, but I just could not find the answer!
\n\nWhy doesn\'t
\n\nreturn x == 0? \"\" : \"Hello\"\n
\n\ncompile but
\n\nreturn x == 0 ? \"\" : \"Hello\"\n
\n\ndoes?
\n\nThis is really weird because all the other operators don\'t need an extra white space. e.g.
\n\nlet x = 1+1\nlet y = 1 + 1\n
\n\nare the same.
\n\nI think it has something to do with optionals. But when you use a ?
operator on a variable, it must be used like this:
let s: String? = nil\nlet x = s?.startIndex\n
\n\nI mean it must follow another operator, right?
\n',I\'m using custom floatingactionmenu. I need to implement scale animation on show/hide menu button like here\nfloating action button behaviour
\n\nIs there any way to do this ?
\n',I have defined integer pointer inside the structure.And i want to use that member pointer using the structure pointer.My code is as shown below:
\n\n#include<stdio.h>\n#include<stdlib.h>\n\nstruct abc\n{\n int *x;\n};\n\nint main()\n{\n\n struct abc *p = (struct abc*)malloc(sizeof(struct abc));\n p->x = (int*)malloc(sizeof(int));\n p->x = 10;\n printf(\"The value is \%d\\n\",p->x);\n free(p);\n}\n
\n\nNow i am getting output as per my expectation.But i have got warning message while compiling.The warning messages are:
\n\ntemp.c:14:7: warning: assignment makes pointer from integer without a cast [enabled by default]\ntemp.c:15:2: warning: format ‘\%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat]\n
\n\nI have also tried,
\n\n*p->x = 10\n printf(\"The value is \%d\\n\",*p->x);\n
\n\nbut it is not working.
\n\nHow to solve this warning?
\n',I was able to change theme using this.RequestedTheme = ElementTheme.Dark;
\nBut what I need is the whole application level, since this one only change the theme of the current page to dark.
Whenever I try this App.Current.RequestedTheme = ApplicationTheme.Dark;
\nI always get this error
\n\n\nAn exception of type \'System.NotSupportedException\' occurred in UWPApp.exe but was not handled in user code
\n
Is there such a way that I can change the whole application theme from Light to Dark or vice versa?
\n\nI\'m using VS2015
\n',I\'m trying to extract US states from wiki URL, and for which I\'m using Python Pandas.
\n\nimport pandas as pd\nimport html5lib\nf_states = pd.read_html(\'https://simple.wikipedia.org/wiki/List_of_U.S._states\') \n
\n\nHowever, the above code is giving me an error L
\n\n\n\n\nImportError Traceback (most recent call last)\n in ()\n 1 import pandas as pd\n ----> 2 f_states = pd.read_html(\'https://simple.wikipedia.org/wiki/List_of_U.S._states\')
\n \nif flavor in (\'bs4\', \'html5lib\'):\n 662 if not _HAS_HTML5LIB:\n --> 663 raise ImportError(\"html5lib not found, please install it\")\n 664 if not _HAS_BS4:\n 665 raise ImportError(\"BeautifulSoup4 (bs4) not found, please install it\")\n ImportError: html5lib not found, please install it
\n
I installed html5lib and beautifulsoup4 as well, but it is not working. \nCan someone help pls.
\n',I am new to Ubuntu (Linux tbh). I encountered problem with starting MongoDB service. I want to created web app using Ruby on Rails and MongoDB but mongo seems to fail to start.
\n\nI followed this MongoDB installation on Ubuntu all of installation went without problems until I got to sudo service mongod start
mongod.log
\n\n2016-01-01T10:58:15.545+0000 I CONTROL ***** SERVER RESTARTED *****\n2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] MongoDB starting : pid=3868 port=27017 dbpath=/var/lib/mongodb 64-bit host=damian-CX61-0NC-CX61-0ND-CX61-0NF-CX61-0NE\n2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] db version v3.0.8\n2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] git version: 83d8cc25e00e42856924d84e220fbe4a839e605d\n2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] build info: Linux ip-10-187-89-126 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49\n2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] allocator: tcmalloc\n2016-01-01T10:58:15.548+0000 I CONTROL [initandlisten] options: { config: \"/etc/mongod.conf\", net: { bindIp: \"127.0.0.1\", port: 27017 }, storage: { dbPath: \"/var/lib/mongodb\", journal: { enabled: true } }, systemLog: { destination: \"file\", logAppend: true, path: \"/var/log/mongodb/mongod.log\" } }\n2016-01-01T10:58:15.567+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted\n2016-01-01T10:58:15.567+0000 I - [initandlisten] Fatal Assertion 28578\n2016-01-01T10:58:15.567+0000 I - [initandlisten] \n\n***aborting after fassert() failure\n
\n\nSo what I am doing wrong or its different issue?
\n',I am kinda new to Android development, but I coded a lot of C#(WinF,WPF). I created an quiz app (German words) for app and I\'m not quite sure how to store and load dictionaries (a file, where lines contain 2 words). What is the best way to store these dictionaries? I googled a bit, but didn\'t find exact answers. At the moment I generate the words directly in the code. \nThanks!
\n',My podfile was working but after updating to cocoapods version 1.0.0.beta.1
\n\npod install displays following error
\n\nMacBook-Pro:iOS-TuneIn home$ pod install\nFully deintegrating due to major version update\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\nDeleted 1 \'Embed Pods Frameworks\' build phases.\n- libPods.a\n- Pods.debug.xcconfig\n- Pods.release.xcconfig\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\nDeleted 1 \'Copy Pods Resources\' build phases.\nDeleted 1 \'Check Pods Manifest.lock\' build phases.\n- libPods.a\n- libPods.a\nDeleted 1 empty `Pods` groups from project.\nRemoving `Pods` directory.\n\nProject has been deintegrated. No traces of CocoaPods left in project.\nNote: The workspace referencing the Pods project still remains.\nUpdating local specs repositories\nAnalyzing dependencies\n[!] The dependency `AFNetworking (= 2.6.3)` is not used in any concrete target.\nThe dependency `MBProgressHUD (~> 0.9.1)` is not used in any concrete target.\nThe dependency `PDKeychainBindingsController (~> 0.0.1)` is not used in any concrete target.\nThe dependency `FMDB/SQLCipher` is not used in any concrete target.\nThe dependency `ZXingObjC (~> 3.1.0)` is not used in any concrete target.\nThe dependency `SDWebImage (~> 3.7.2)` is not used in any concrete target.\nThe dependency `SignalR-ObjC (~> 2.0.0.beta3)` is not used in any concrete target.\nThe dependency `CJPAdController (from `https://github.com/nabeelarif100/CJPAdController.git`)` is not used in any concrete target.\nThe dependency `ECSlidingViewController (~> 2.0.3)` is not used in any concrete target.\nThe dependency `VGParallaxHeader` is not used in any concrete target.\nThe dependency `EMString` is not used in any concrete target.\nThe dependency `Google/SignIn` is not used in any concrete target.\nThe dependency `VIPhotoView (~> 0.1)` is not used in any concrete target.\nThe dependency `EncryptedCoreData (from `https://github.com/project-imas/encrypted-core-data.git`)` is not used in any concrete target.\nMacBook-Pro:iOS-TuneIn home$ \n
\n\nPodfile:
\n\nsource \'https://github.com/CocoaPods/Specs.git\'\nplatform :ios, \'7.0\'\npod \'AFNetworking\', \'2.6.3\'\npod \'MBProgressHUD\', \'~> 0.9.1\'\npod \'PDKeychainBindingsController\', \'~> 0.0.1\'\npod \'FMDB/SQLCipher\'\npod \'ZXingObjC\', \'~> 3.1.0\'\npod \'SDWebImage\', \'~>3.7.2\'\npod \'SignalR-ObjC\',\'~>2.0.0.beta3\'\npod \'CJPAdController\', :git => \'https://github.com/nabeelarif100/CJPAdController.git\'\npod \'ECSlidingViewController\', \'~> 2.0.3\'\npod \'VGParallaxHeader\'\npod \'EMString\'\npod \'Google/SignIn\'\npod \'VIPhotoView\', \'~> 0.1\'\npod \'EncryptedCoreData\', :git => \'https://github.com/project-imas/encrypted-core-data.git\'\n
\n',I am trying to make a constructor for a derived class. Doing it this way doesn\'t seem to work:
\n\n#include <iostream>\n\nclass FirstClass\n{\npublic:\n int X;\n FirstClass(int x)\n {\n this->X = x;\n }\n int getXpow() { return pow(X, 2); }\n\n};\n\nclass SecondClass : FirstClass\n{\npublic:\n SecondClass(int x)\n {\n FirstClass::FirstClass(X);\n }\n\n int getXpow() { return pow(X, 3); }\n};\n\nint main()\n{\n using namespace std;\n FirstClass FCobj(3);\n cout << FCobj.getXpow() << endl;\n SecondClass SCobj(3);\n cout << SCobj.getXpow() << endl;\n\n system(\"pause\");\n return 0;\n}\n
\n\nbecause it says at the first {
bracket of SecondClass(int x)
the following thing Error: no default constructor exists for class \"FirstClass\"
. And how does constructor inheritance even work?
I\'m getting a bit lost in TS re-exports. Say I create a pair of test modules;
\n\ntest1.ts;
\n\nexport function test1() {\n return \'test\';\n}\n
\n\ntest2.ts;
\n\nexport function test2() {\n return \'test\';\n}\n
\n\nI believe I should be able to then do something like this;
\n\ncombined.ts;
\n\nexport * from \'./test1\';\nexport * from \'./test2\';\n\nmodule.exports = {\n test1: test1,\n test2: test2\n};\n
\n\nBut, no such luck. There seem to be lots of GitHub issues discussing various approaches to this, including an old hack using export import * from \'./test1\'
but they all seem to argue what the ES6 spec really means, and none actually work..
What\'s the right way to do a rollup like this? Am I just going down the wrong path to split a module up across files? Are namespaces more appropriate here?
\n',I\'m trying to use stack to load my test-suite in ghci and have it load the QuickCheck and hspec dependency.
\n\nHow can I do this?
\n\nI\'m using the franklinchen template.
\nhttps://github.com/commercialhaskell/stack-templates/blob/master/franklinchen.hsfiles
I have tried
\nstack ghci spec
\nstack ghci test-suite
\nstack ghci --main-is spec
I modified the test-suite spec to target the main-is: LibSpec.hs file
\n\ntest-suite spec\n default-language: Haskell2010\n ghc-options: -Wall\n type: exitcode-stdio-1.0\n hs-source-dirs: test\n main-is: LibSpec.hs\n build-depends: base\n , chapterexercises\n , hspec\n , QuickCheck\n
\n',I am trying out the new Fetch API but is having trouble with Cookies. Specifically, after a successful login, there is a Cookie header in future requests, but Fetch seems to ignore that headers, and all my requests made with Fetch is unauthorized.
\n\nIs it because Fetch is still not ready or Fetch does not work with Cookies?
\n\nI build my app with Webpack. I also use Fetch in React Native, which does not have the same issue.
\n',Now that I\'ve learned Swift (to a reasonable level) I\'m trying to get to grips with the standard library, but in truth it\'s mainly ελληνικά to me!
\n\nSo a specific question: I have an array of strings and I can call reverse() on it.
\n\nlet arr = [\"Mykonos\", \"Rhodes\", \"Naxos\"].reverse()\n
\n\nNow naively I thought I\'d get back a type of Array from this. (Ruby for example has a similar method that you pass an array and get back an array)
\n\nBut arr is now actually of type
\n\nReverseRandomAccessCollection<Array<String>>\n
\n\nwhich is actually a struct, which conforms to CollectionType:
\n\npublic struct ReverseRandomAccessCollection<Base : CollectionType where Base.Index : RandomAccessIndexType> : _ReverseCollectionType\n
\n\nThis means I can do this:
\n\nfor item in arr {\n print(item)\n}\n
\n\nbut I can\'t do
\n\nprint(arr[0])\n
\n\nWhy is this designed to be this way?
\n\nDictionaries in Swift also implement CollectionType, so I can do this:
\n\nlet dict = [\"greek\" : \"swift sometimes\", \"notgreek\" : \"ruby for this example\"].reverse()\n
\n\nBut dictionaries are not ordered like arrays, so why can I call reverse() on dicts?
\n\nBonus points if anyone can point me in the direction of where I can read up and improve my Swift stdlib foo, Ευχαριστώ!
\n',I am trying to deploy an application version but eb deploy
command fails with:
\n\n\nERROR: Update environment operation is complete, but with errors. For\n more information, see troubleshooting documentation.
\n
I checked the logs, made some changes to the code, committed and deployed again and guess what, it failed again. The logs indicate the same error, disregarding my changes. The error occurs in a file in this directory /var/app/ondeck/app/
, when I go check, I can see the previous version is there.
I tried deploying using the Elastic Beanstalk dashboard, but somehow the instance is not receiving the new version. Can someone help me with this? Thanks.
\n',lt = [\'7,777.7\', \'777.7\', \'77,777.7\', \'77.7\']\n
\n\nHow can I proceed to print the list content like this ?
\n\n 7,777.7\n 777.7\n77,777.7\n 77.7\n
\n',What is the difference between bluebird.js and bluebird.core.js?
\n\nWhen should I use bluebird.core.js instead of bluebird.js?
\n\nI haven\'t been able to find anything in the bluebird site or elsewhere.
\n',PowerShell 5 introduces the New-TemporaryFile
cmdlet, which is handy. How can I do the same thing but instead of a file create a directory? Is there a New-TemporaryDirectory
cmdlet?
I am deploying a file along with a C# application. And I want to make sure that file is same as it was supplied otherwise the C# application will show error. Now, a file\'s creation and modification date can be changed after it is modified. Is there any checksum/hash etc. in C# to make sure file is not changed by user.
\n',I\'d like my class init() in Swift to throw an error if something goes wrong with loading a file into a string within the class. Once the file is loaded, the string will not be altered, so I would prefer to use let. This works:
\n\nclass FileClass { \n var text: NSString = \"\" \n init() throws { \n do {\n text = try NSString( contentsOfFile: \"/Users/me/file.txt\", encoding: NSUTF8StringEncoding ) }\n catch let error as NSError {\n text = \"\"\n throw error\n } \n }\n}\n
\n\nbut when I replace
\n\nvar text: NSString = \"\"\n
\n\nwith
\n\nlet text: NSString\n
\n\nI get an All stored properties of a class instance must be initialized before throwing from an initializer error.
\n\nI\'ve tried various approaches such as to make text optional
\n\nlet text: NSString?\n
\n\nbut haven\'t found any that work. It it possible to have text be loaded from a file, immutable, and for init() to throw an error? Can I have my cake and eat it three?
\n\nMany thanks in advance!
\n',I\'m not sure, if this question is unique, but I couldn\'t find the answer that I was looking for.
\n\nI simply need a C# code that counts how many times a word appear in richTextBox1 and send the result to label1.
\n\nExample;\nlabel1.text = how many times the word \"house\" appears in richTextBox1.
\n\nI know that I should try first but believe me I tried and I failed. I am new to this so I hope someone can show me.
\n\nRegards
\n',I want to create a bigger Floating Action Button (FAB), more than the usual 56 dp, with a bigger icon inside.\n(For my purpose an icon will never be self-explanatory so I will create a png-file containing a short text and use this png as icon.)
\n\nIncreasing the size of the FAB works fine:
\nas i don\'t use the mini-FloatingActionButton, i redefined the mini-button-size.
\nin my layout-xml i specify:
<android.support.design.widget.FloatingActionButton\n ...\n app:fabSize=\"mini\"\n ....\n
\n\nand in the dimensions.xml i redefine the size for the mini-fab:
\n\n<dimen name=\"fab_size_mini\">80dp</dimen>\n
\n\nHowever, I didn\'t manage to get a bigger icon on the FAB.\nI tried icons with different dp\'s from the material icons library - no success. Also setting a padding on the FAB-layout did not work.
\n\nAny suggestions? Thanks!
\n',app/boot.ts
\n\nimport {bootstrap} from \'angular2/platform/browser\';\nimport {AppComponent} from \'./app.component\';\nbootstrap(AppComponent);\n
\n\napp/app.component.ts
\n\nimport {Component} from \'angular2/core\';\n@Component({\n selector: \'my-app\',\n template: \'{{title}}\'\n})\nclass AppComponent {\n title: \"app\"\n}\n
\n\nError:
\n\nEXCEPTION: Token must be defined!\nSTACKTRACE:BrowserDomAdapter.logError @ angular2.dev.js:23514\nExceptionHandler.call @ angular2.dev.js:1147\n(anonymous function) @ angular2.dev.js:14801\nNgZone._notifyOnError @ angular2.dev.js:5796\ncollection_1.StringMapWrapper.merge.onError @ angular2.dev.js:5700\nrun @ angular2-polyfills.js:141\n(anonymous function) @ angular2.dev.js:5719\nNgZone.run @ angular2.dev.js:5681\nApplicationRef_.bootstrap @ angular2.dev.js:14906\nbootstrap @ angular2.dev.js:25054\nexecute @ boot.ts:4\nu @ system.src.js:4597\nexecute @ system.src.js:4597\ny @ system.src.js:4597\n...\n
\n',According to scala-wartremover static analysis tool I have to put \"final\" in front of every case classes I create: error message says \"case classes must be final\".
\n\nAccording to scapegoat (another static analysis tool for Scala) instead I shouldn\'t (error message: \"Redundant final modifier on case class\")
\n\nWho is right, and why?
\n',I am working on a project for my company and we are not allowed to alter the HTML in any way. There is already a Page set up in the Using html to do Data Validation. There are to separate forms of validation questions on the page and each form contains its own \"submit\" button. Although both submit buttons have the same \"id\". is there any way to figure out how isolate each button to apply a different \".onclick\" method to them. Thanks in advance.
\n',I have a Kotlin project where I\'d like to have Kotlin warnings treated as errors. How can I do that?
\n',I would like to run a process in a thread (which is iterating over a large database table). While the thread is running, I just want the program to wait. If that thread takes longer then 30 seconds, I want to kill the thread and do something else. By killing the thread, I mean that I want it to cease activity and release resources gracefully.
\n\nI figured the best way to do this was through a Thread()
\'s join(delay)
and is_alive()
functions, and an Event
. Using the join(delay)
I can have my program wait 30 seconds for the thread to finish, and by using the is_alive()
function I can determine if the thread has finished its work. If it hasn\'t finished its work, the event is set, and the thread knows to stop working at that point.
Is this approach valid, and is this the most pythonic way to go about my problem statement?
\n\nHere is some sample code:
\n\nimport threading\nimport time\n\n# The worker loops for about 1 minute adding numbers to a set\n# unless the event is set, at which point it breaks the loop and terminates\ndef worker(e):\n data = set()\n for i in range(60):\n data.add(i)\n if not e.isSet():\n print \"foo\"\n time.sleep(1)\n else:\n print \"bar\"\n break\n\ne = threading.Event()\nt = threading.Thread(target=worker, args=(e,))\nt.start()\n\n# wait 30 seconds for the thread to finish its work\nt.join(30)\nif t.is_alive():\n print \"thread is not done, setting event to kill thread.\"\n e.set()\nelse:\n print \"thread has already finished.\"\n
\n',I searched for the cause of this error and found that I have to change permissions or run gulp using sudo, but still got the same error.\nCan anyone please help...
\n\ninternal/child_process.js:298\n throw errnoException(err, \'spawn\');\n ^
\n\nError: spawn EACCES\n at exports._errnoException (util.js:870:11)\n at ChildProcess.spawn (internal/child_process.js:298:11)\n at exports.spawn (child_process.js:362:9)\n at exports.execFile (child_process.js:151:15)\n at ExecBuffer. (/var/www/conFusion/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/exec-buffer/index.js:91:3)\n at /var/www/conFusion/node_modules/gulp-rev/node_modules/vinyl-file/node_modules/graceful-fs/graceful-fs.js:42:10\n at /var/www/conFusion/node_modules/gulp-cache/node_modules/cache-swap/node_modules/graceful-fs/graceful-fs.js:42:10\n at /var/www/conFusion/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/vinyl-fs/node_modules/graceful-fs/graceful-fs.js:42:10\n at FSReqWrap.oncomplete (fs.js:82:15)
\n',I\'ve got ome fail in java enums;
\n\nI\'d like to have individual id number for specified enum created, but number seems to propagate to next enum object unfortunately.\nLook at my case:
\n\nenum type{ int i;}\nint id=1;\ntype t1.i=id;\nid=2;\ntype t2.i=id;\n
\n\nBut t1 has got t2 id number, but I want to have different id\'s.
\n\nIs there any solution in this case ?
\n\nI inform that it\'s simplification of my case and I can\'t change enum type to class.
\n',I\'m running uWSGI behind Nginx and have been using proxy_pass
to get Nginx to hit uWSGI. Is there any benefit to switch to uwsgi_pass
. If so, what is it?
I want to play animated gif from url in android app like imgur app. Imagur is superb and very fast. I am loading gif with webview but its not up to the mark.
\n',I\'m having trouble understanding and using Django\'s ImageField.
\n\nI have a model:
\n\nclass BlogContent(models.Model):\n title = models.CharField(max_length=300)\n image = models.ImageField(upload_to=\'static/static_dirs/images/\')\n description = models.TextField()\n
\n\nMy file system is currently:
\n\nsrc\n |---main_project\n |---app_that_contains_blog_content_model\n |---static\n |---static_dirs\n |---images\n
\n\nWhen I run the server and go to the Admin page, I can add BlogContent objects. After choosing an image for the image field, the image has a temporary name. However, after I save this object I can\'t find the image in the folder specified by the upload_to path.
\n\nWhat is the correct way to do this?
\n',Many questions have been asked here about functions from math.h not being found in C code during compilation and I am facing a similar problem. Having gone through all of them, none seems to apply to my problem. I have some C code in a file called test1.c -
\n\n#include <math.h>\nint main(void) {\n int j = SQR(4);\n int i = (int)(sqrt(16.0));\n}\n
\n\nNow, I compile this using -
\n\ngcc -c -o ../../obj/test1.o test1.c -I../../include\n
\n\nAnd it produces the .o file.
\n\nNow, I try and create the executable using -
\n\ngcc -o ../../bin/test1../../obj/test1.o -I../../include -lm\n
\n\nBut this gives me the error below (most previous questions were solved by the -lm switch but I have that) -
\n\n../../obj/test1.o:test1.c:(.text+0x13): undefined reference to `SQR\'\n../../obj/test1.o:test1.c:(.text+0x13): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `SQR\'\n
\n\nStrangely, sqrt works but a host of other functions like SQR, SIGN etc lead to problems (the case doesn\'t matter). Note that these commands were generated by a make file -
\n\nIDIR =../../include\nCC=gcc\nCFLAGS=-I$(IDIR)\n\nODIR=../../obj\nLDIR =../../lib\n\nLIBS=-lm\n\n_DEPS = nrutil.h\nDEPS = $(patsubst \%,$(IDIR)/\%,$(_DEPS))\n\n_OBJ = test1.o\nOBJ = $(patsubst \%,$(ODIR)/\%,$(_OBJ))\n\n\n$(ODIR)/\%.o: \%.c $(DEPS)\n $(CC) -c -o $@ $< $(CFLAGS)\n\n../../bin/svdcmp: $(OBJ)\n gcc -o $@ $^ $(CFLAGS) $(LIBS)\n\n.PHONY: clean\n\nclean:\n rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~\n
\n\nI\'m using Cygwin with Windows.
\n',I recently came across a code snippet such as:
\n\ndef loop(ring_pid \\\\ self, nil, true) do\n #some code \nend\n
\n\nWhat do the double backslashes mean? I googled around and found http://elixir-lang.org/getting-started/sigils.html, but that applies to regular expressions not function params.
\n',I\'m planning to use SASS in making a website instead of CSS. I\'m trying to compile a SASS file to CSS. Should I use an application to do so? Or should I use just command prompt?
\n',When I use a prototype table view, I always have to conform to the protocol TableViewDataSource
. I always forget what methods I need to implement, so I have to look at the source of the protocol every time. This is really time consuming.
I think Xcode must have a feature that automatically implements the needed methods for you, right? Just like IntelliJ IDEA, Eclipse, and Visual Studio.
\n\nI want to know where can I find this feature. If there\'s isn\'t, is there a workaround for this? At least I don\'t have to open the source code of the protocol each time I conform to it.
\n\nIf you don\'t understand what I mean, here\'s some code:
\n\nI have a protocol
\n\nprotocol Hello {\n func doStuff ()\n}\n
\n\nWhen I conform to it,
\n\nclass MyClass: Hello {\n\n}\n
\n\nI often don\'t remember the names of the methods that I need to implement. If Xcode has a feature that turns the above code, into this:
\n\nclass MyClass: Hello {\n func doStuff () {\n code\n }\n}\n
\n\nNow you understand what I mean? I just want to ask where to find such a feature.
\n',I want to be able to detect if a mongo server is available from the java driver for the purpose of reacting to any abnormal events as one would in JDBC land etc. It all works fine when the server is up but I am struggling to understand why it is so difficult to detect errors. I have a feeling its because the mongo client runs in a different thread and it doesn\'t re throw to me or something?
\n\ntry {\n MongoClient mongoClient = new MongoClient(\"localhost\", 27017);\n MongoDatabase db = mongoClient.getDatabase(\"mydb\");\n // if db is down or error getting people collection handle it in catch block\n MongoCollection<Document> people = commentarr.getCollection(\"people\");\n } catch (Exception e) {\n // handle server down or failed query here.\n }\n
\n\nThe result is
\n\nINFO: Exception in monitor thread while connecting to server localhost:27017\n
\n\nWith the resulting stack trace containing a few different exceptions which I have tried to catch but my catch blocks still didn\'t do anything.
\n\ncom.mongodb.MongoSocketOpenException: Exception opening socket\nCaused by: java.net.ConnectException: Connection refused\n
\n\nI am using the java mongodb driver 3.0.4, most posts I read are from an older API with hacks like MongoClient.getDatabaseNames()
which throws a MongoException
if errors, except this is deprecated now and replaced with MongoClient.listDatabaseNames()
which doesn\'t have the same error throwing semantics.
Is there a way to just execute a mongo query from the java driver in a try catch block and actually have the exception caught?
\n',I need a little help.\nI\'m try to UPDATE a datetime to MySQL, but it didn\'t work.
\n\nThe declaration is like this:
\n\n $startDate = time();\n $time = date(\"Y-m-d H:i:s\", strtotime(\'+7 days\', $startDate));\n
\n\nAfter this i want to UPDATE, but in MySQL is still blank always.
\n\nUPDATE:
\n\nmtquery(\"UPDATE table SET end_time = \".$time.\" WHERE id = \".$table[\'id\'].\"\");\n
\n\nIf i use NOW() instead of \".$time.\", it works perfectly.
\n\nIf someone can help, please write the solution.
\n\nThanks,
\n\nKoLi
\n',I am following Angular 2 quick start tutorial. Following is my folder structure -
\n\n├── gulpfile.js\n├── index.html\n├── js\n| ├── app.component.js\n| └── boot.js\n├── source\n| ├── app.component.ts\n| └── boot.ts\n├── node_modules\n ├── module 1\n └── module 2\n
\n\nMy typescript files are in source/
directory. I\'m compiling it to js/
directory. I\'m using gulp-typescript.
The problem is when I, for example, rename the file boot.ts
to bootstrap.ts
and compile again, corresponding bootstrap.js
file is created but the old boot.js
file still remains in the js/ directory.
Now the folder structure looks like following-
\n\n├── gulpfile.js\n├── index.html\n├── js\n| ├── app.component.js\n| └── bootstrap.js\n| └── boot.js\n├── source\n| ├── app.component.ts\n| └── bootstrap.ts\n├── node_modules\n ├── module 1\n └── module 2\n
\n\nI want to delete this boot.js
autonomically via gulp task. How to achieve this?
I have seen on other AndroidStudio-pictures, that there is a RAM usage at the right bottom. I tried to setup this statuslist o the bottom. But a rightclick didn`t help me. How can I switch on the RAM usage in AndroidStudio ?
\n',On a blog on the progress of C++17 I read the following:
\n\n\n\n\n\n\n
P0007
proposes a helper function templateas_const
, which simply\n takes a reference and returns it as a reference toconst
.\ntemplate <typename T> std::add_const_t<T>& as_const(T& t) { return t }\ntemplate <typename T> void as_const(T const&&) = delete;\n
Why is the const&&
overload deleted?
In Windows 10, when I launch MS PowerShell to ssh through a container in Kitematic at windows, I\'ve noticed that I can\'t backspace or delete, instead I get ^H for backspace instead of actually delete previous character.
\n\nDo I miss something?
\n',Has set
been deprecated in python?
I am learning python online here and trying to implement the following command -
\n\nx = set([\"Perl\", \"Python\", \"Java\"])\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: \'list\' object is not callable\n
\n\nSo has it been deprecated in python 2.7?
\n',I installed Oracle JDK from the webupd8team/java
PPA, and then installed the visualvm
package. When starting visualvm
, I get the following error message:
[beni:~]$ visualvm\nNo jdkhome found\n
\n\nMy $JAVA_HOME
is set correctly to /usr/lib/jvm/java-7-oracle
.
Also, when starting visualvm
with the jdkhome
property set, I get the same error:
[beni:~]$ visualvm --jdkhome $JAVA_HOME\nNo jdkhome found\n
\n',To give a little context to my issue...
\n\nI have a Java EE web application (as a UI / client) that accesses services for data / business logic via a REST interface using the JAX-RS 2.0 client API (Resteasy implementation).
\n\nCurrently I inject a new JAXRS Client instance per request using a RequestScoped CDI managed bean, the thinking being that the client app may call multiple backend resources per request and I reuse the same JAXRS Client for the whole request (although I read somewhere this may not be correct as I am potentially changing the URI for each invocation)
\n\nThe documentation for JAXRS Client seems to suggest that the client is a potentially expensive operation and the app should limit the amount of connections it creates. It also seems to contradict itself and suggest the client should be closed once all the requests to a particular WebTarget are finished.
\n\nThe client application could potentially support thousands of simultaneous users so creating and destroying thousands of \'expensive clients\' does not seem to be the correct approach so am thinking a shared client pool is more appropriate but there doesn\'t seem to be any information on how this should be achieved.
\n\nAll examples appear to show creating a new client for the request and a) closing it after or b) not closing it but not really explaining what happens on a second request.
\n\nCan you help provide some answers on how you think this would be solved or information on what the best practice for this approach is.
\n\nThanks.
\n',So I am trying to make a simple program (I\'m a student) and it works fine so far, but I can\'t figure out how to display the \"i\" value from the loop in the drawCircle() function in Shapes.cpp
\n\ncode:
\n\n\n\n\n\nWhen I compile my code right now it looks like on the image to the left, but I want to get something like on the right but I have no idea how to do that kind of stuff or what function should I use for that.
\n\nPlease help
\n',I recently discovered, quite harshly, that Matlab\'s dlmread
and dlmwrite
don\'t store numerical values at double
accuracy. It effects my code, and I need to store big arrays with more precision.
A (not) working example :
\n\npi1 = pi;\ndlmwrite(\'pi\',pi1);\npi2 = dlmread(\'pi\');\npi1-pi2\n\nans =\n\n-7.3464e-06\n
\n\nWhile I\'d expect machine-error answer, of 10^-14 accuracy.
\n\nI\'d much rather keep using a simple function as dlmwrite
, but I will consider other solutions.
Thanks
\n',Why would one use contextlib.suppress
to suppress an exception, instead of try
/except
with a pass
?
There is no difference in the amount of characters between these two methods (if anything, suppress
has more characters), and even though code is often counted in LOC instead of characters, suppress
also seems to be much slower than try
/except
in both cases, when an error is raised and when it\'s not:
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32\nType \"copyright\", \"credits\" or \"license()\" for more information.\n>>> from timeit import timeit\n>>> # With an error\n>>> timeit(\"\"\"with suppress(ValueError):\n x = int(\'a\')\"\"\", setup=\"from contextlib import suppress\")\n1.9571568971892543\n>>> timeit(\"\"\"try:\n x = int(\'a\')\nexcept ValueError:\n pass\"\"\")\n1.0758466499161656\n>>> # With no error\n>>> timeit(\"\"\"with suppress(ValueError):\n x = int(3)\"\"\", setup=\"from contextlib import suppress\")\n0.7513525708063895\n>>> timeit(\"\"\"try:\n x = int(3)\nexcept ValueError:\n pass\"\"\")\n0.10141028937128027\n>>> \n
\n',After Updating the android version 1.5 to 2.0 Preview4. Android studio Debugger unable to find the local variable defined in method definition. For reference, find the below screenshot.
\n\n\n',I am new to android studio and volley library so please bear with me.
\n\nI\'ve added volley library by GitHub and then and added this line to build gradle file: compile \'com.android.support:appcompat-v7:23.0.1\'
\n\nAnd now I am trying some tutorials about request and response from api, but for some reason I cannot make an instance of RequestQueue why? \nI am using Android 4.0.3 IceCreamSandwish
\n\nThank you
\n',I am new to shell script. I need your help on below scenario.
\n\nScript: wc file1 file2 file3 file4
\n\nresults :\n1488 2977 2248 file1\n123 345 657 file2\n123 896 456 file3\n567 987 124 file4\n
\n\nNow I need to mail this result in below format with header name
\n\nHere,2nd column is always default value.
\n\nFilename Destname rowcount bytesize\nfile1 default 1488 2248\nfile2 default 123 657\nfile3 default 123 456\nfile4 default 567 124\n
\n\nPlease some one help me to write this script.
\n',I created a file called file2.txt
in Linux, opened it in text editor and saved it. When I closed the text editor I see two files file2.txt
and file2.txt~
I guess file2.txt~
is temporary file created when I am editing the file2.txt
but it should get removed when I finished saving and closed text editor.
In Python-telegram-bot how to get, if possible, the complete list of all participants of the group at which the bot was added?
\n',I\'m developing a Play 2.4 application and would like SBT to run webpack to generate static assets during compilation.
\n\nI tried https://github.com/stejskal/sbt-webpack but it does\'t seem to work for me.
\n',I\'m sure this is simple but cant find the answer.
\n\nThere is a standard Jekyll/Liquid post iterator. How do i use the {\% if \%}
statement below to put the <hr>
element for each post except the last?
<ul class=\"post-list\">\n {\% for post in site.posts \%}\n {\% if post.url \%}\n <br>\n <li>\n <h2>\n <a class=\"post-link\" href=\"{{ post.url | prepend: site.baseurl }}\">{{ post.title }}</a>\n </h2>\n <span class=\"post-meta\">{{ post.date | date: \"\%b \%-d, \%Y\" }}</span>\n </li>\n\n **** {\% if post != $last \%} ***** How do i do this??\n <hr>\n {\% endif \%}\n {\% endif \%}\n {\% endfor \%}\n </ul>\n
\n',I have a question.I think I may have a mistake in my code because my code program(Dev C++) seems not to recognize the \"else if\" statement.
\n\nHere is the code:
\n\n#include <stdio.h>\nint main()\n{\nint a = 80;\nif(a == 10);\nprintf(\"value of a is 10\\n\");\nelse if(a == 20);\nprintf(\"value of a is 20\\n\");\nelse if(a == 30);\nprintf(\"value of a is 30\\n\");\nelse\nprintf(\"none of the values match\");\nprintf(\"the real value of a is: &d\", a);\n\nsystem(\"PAUSE\");\nreturn 0;\n}\n
\n',Let\'s say you have the repository:
\n\nmyCode/megaProject/moduleA\nmyCode/megaProject/moduleB\n
\n\nOver time (months), you re-organise the project. Refactoring the code to make the modules independent. Files in the megaProject directory get moved into their own directories. Emphasis on move - the history of these files is preserved.
\n\nmyCode/megaProject\nmyCode/moduleA\nmyCode/moduleB\n
\n\nNow you wish to move these modules to their own GIT repos. Leaving the original with just megaProject on its own.
\n\nmyCode/megaProject\nnewRepoA/moduleA\nnewRepoB/moduleB\n
\n\nThe filter-branch
command is documentated to do this but it doesn\'t follow history when files were moved outside of the target directory. So the history begins when the files were moved into their new directory, not the history the files had then they lived in the old megaProject directory.
How to split a GIT history based on a target directory, and, follow history outside of this path - leaving only commit history related to these files and nothing else?
\n\nThe numerous other answers on SO focus on generally splitting apart the repo - but make no mention of splitting apart and following the move history.
\n',I have a data set called \'md\' which consists of 40 numbers 1-6, I need to get the proportion that the number 1 appears in the list, I\'ve been looking for ways to get proportions but none of which seem to be relevant to my data set, the proportion is easily calculable, however, it is required to be done in R.
\n',I´ve came across the following error. \nAt the moment I developing an Android App with React Native therefore I´m planning to use fetch for doing a post request for me.
\n\nfetch(\"https://XXreachable-domainXX.de/api/test\", {\n method: \"post\",\n\n body: JSON.stringify({\n param: \'param\',\n param1: \'param\',\n\n })\n }\n )\n .then((response) = > response.json()\n )\n .\n then((responseData) = > {\n ToastAndroid.show(\n \"Response Body -> \" + JSON.stringify(responseData.message), ToastAndroid.SHORT\n )\n})\n .\n catch((error) = > {\n console.warn(error);\n})\n ;\n
\n\nThe app now throws an error:
\n\n\n\n\nTypeError: Network request failed
\n
When I change the code to a GET-Request it´s working fine, in the browser with a window.alert() as a return it´s cool and also the chrome extension Postman returns data correctly.
\n',\n\n',bufferutil@1.2.1 install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can\'t find Python executable \"/path/to/executable/python2.7\", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Linux 3.13.0-74-generic gyp ERR! command \"/usr/bin/nodejs\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\" gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/bufferutil gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install:
\nnode-gyp rebuild
npm WARN install:bufferutil@1.2.1 Exit status 1 > utf-8-validate@1.2.1 install /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: Can\'t find Python executable \"/path/to/executable/python2.7\", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11 gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:78:16) gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:82:29) gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:93:16 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15) gyp ERR! System Linux 3.13.0-74-generic gyp ERR! command \"/usr/bin/nodejs\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\" gyp ERR! cwd /home/sudthenerd/polymer-starter-kit-1.2.1/node_modules/utf-8-validate gyp ERR! node -v v5.3.0 gyp ERR! node-gyp -v v3.2.1 gyp ERR! not ok npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install:node-gyp rebuild
npm WARN install:utf-8-validate@1.2.1 Exit status 1
Why in an Ecto changeset
method do you set the params to the default :empty
atom? e.g.
def changeset(user, params \\\\ :empty) do\n ...\n
\n\nDoes this allow you to call the changeset method with nil for params?
\n',I\'m working with Abstract Syntax Trees in Python 3. The ast
library gives many ways to get children of the node (you can use iter_child_nodes()
or walk()
) but no ways to get parent of one. Also, every node has links to its children, but it hasn\'t links to its parent.
How I can get the parent of AST node if I don\'t want to write some plugin to ast
library?
What is the most correct way to do this?
\n',